home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-07-07 | 4.0 KB | 167 lines | [TEXT/MPS ] |
-
- // ---- End Project Data ----
-
-
- // ---- File main.t ----
-
- // Before Script for "myapp"
- // Copyright ©1993-1994 Apple Computer. All rights reserved.
-
- myapp :=
- {title: "GetPolygon",
- viewBounds: {left: 0, top: 2, right: 236, bottom: 294},
- viewFormat: 83951953
- ,
- viewSetupFormScript:
- func()
- begin
- local b := GetAppParams();
- constant kMaxWidth := 240;
- constant kMaxHeight := 336;
-
- viewBounds := RelBounds(b.appAreaLeft, b.appAreaTop,
- Min(b.appAreaWidth, kMaxWidth),
- Min(b.appAreaHeight, kMaxHeight) );
-
-
- end,
- _proto: protoApp,
- debug: "myapp"
- };
-
- dest := /* child of myapp */
- {viewBounds: {top: 187, left: 34, right: 202, bottom: 290},
- viewFormat: 561,
- viewFlags: 33,
- points: nil,
- viewclass: 82,
- debug: "dest"
- };
- // View dest is declared to myapp
-
-
-
- _view000 := /* child of myapp */
- {viewFlags: 69121,
- viewFormat: 337,
- viewBounds: {left: 9, top: 42, right: 119, bottom: 160},
- viewAddChildScript:
- func(newOne)
- begin
-
- if (newOne.points exists) then
- SetValue(dest, 'points, Clone(newOne.points));
-
- nil;
- //This should return TRUE if you manually added the child
- end,
- viewclass: 77
- };
-
-
-
- _view001 := /* child of myapp */
- {viewFlags: 513,
- viewFormat: 336,
- viewBounds: {left: 128, top: 41, right: 231, bottom: 160},
- viewClickScript:
- func(unit)
- begin
- local array, len, index, b;
- constant kOpenShape := 7;
-
- // wait until the stroke is done
- while not strokedone(unit) do Sleep(10);
- // sleep instead of "do nil" so that you do not run down the battery
-
- array := GetPointsArray(unit);
-
- len := length(array);
- setlength(array, len + 2);
-
- b := :GlobalBox();
-
-
- // The GetPointsArray() function returns an array of points which
- // is ordered y, x...so we need to switch the order in preparation
- // for the ArrayToPoints routine. We do this at the same time we
- // insert two extra elements to the beginning of the array and
- // change "global" stroke points to local points.
- // The two new elements to the array represent the shape type and
- // the number of points.
-
- for index := len - 2 to 0 by -2 do
- begin
- array[index + 2] := array[index + 1] - b.left;
- array[index + 3] := array[index] - b.top + 1;
- end;
-
- array[0] := kOpenShape; // the "polygon shape type" for
- // open curve shapes
- array[1] := len / 2; // how many points in the array?
-
-
- // copy this new data to the destination view
- setvalue(dest, 'points, arraytopoints(array));
-
- // copy this new data to our "shadow view" so that it
- // it looks like the ink is hanging around. We also could
- // create this effect by saving the points array and giving
- // this clView a viewDrawScript to draw the lines...
- setvalue(shadowView, 'points, arraytopoints(array));
-
- RefreshViews();
- nil;
- end,
- viewclass: 74
- };
-
-
-
- _view002 := /* child of myapp */
- {text: "Destination polygonView...",
- viewBounds: {left: 0, top: 169, right: 0, bottom: 185},
- viewJustify: 8388658
- ,
- _proto: protoStaticText
- };
-
-
-
- _view003 := /* child of myapp */
- {text: "clEditView",
- viewBounds: {left: 32, top: 25, right: 120, bottom: 41},
- viewJustify: 8388609,
- _proto: protoStaticText
- };
-
-
-
- _view004 := /* child of myapp */
- {text: "clView",
- viewBounds: {left: 128, top: 25, right: 216, bottom: 41},
- viewJustify: 8388608,
- _proto: protoStaticText
- };
-
-
-
- shadowView := /* child of myapp */
- {viewBounds: {left: 128, top: 40, right: 232, bottom: 160},
- viewFlags: 1,
- points: nil,
- viewFormat: 512,
- viewclass: 82,
- debug: "shadowView"
- };
- // View shadowView is declared to myapp
-
-
-
-
-
-
-
- // ---- Beginning of section for non used Layout files ----
-
- // End of output